home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / addAttributeEditorNodeHelp.m < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.4 KB  |  113 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  24.Jan.2002
  22. //
  23. //<doc>
  24. //<name addAttributeEditorNodeHelp>
  25. //<owner "Alias|Wavefront Unsupported">
  26. //
  27. //<synopsis>
  28. //        addAttributeEditorNodeHelp(string $nodeType, string $helpCommand)
  29. //
  30. //<description>
  31. //        The Attribute Editor's Help menu creates menu items
  32. //        for node types that it is currently displaying. For custom
  33. //        node types use this procedure to specify a help command
  34. //        to be invoked when the custom node type menu item is
  35. //        selected.
  36. //
  37. //<flags>
  38. //        string $nodeType The node type.
  39. //
  40. //        string $helpCommand The command to display help for the node.
  41. //            This command is invoked when the corresponding menu item is 
  42. //            selected from the Attribute Editor Help menu. Specify an 
  43. //            empty string to prevent the menu item for the node type
  44. //            from being created.
  45. //
  46. //<returns>
  47. //        Nothing.
  48. //
  49. //<examples>
  50. //
  51. //    //    Prevent a menu item in the Help menu from being
  52. //    //    created for nodes of type "customNodeType1".
  53. //    //
  54. //    addAttributeEditorNodeHelp("customNodeType1", "");
  55. //
  56. //    //    Use the showHelp command to display a specific web page
  57. //    //    when the "customNodeType2" Help menu item is selected.
  58. //    //
  59. //    addAttributeEditorNodeHelp("customNodeType2",
  60. //        "showHelp -absolute \"http://www.aliaswavefront.com\"");
  61. //
  62. //    //    Use the print command to inform user no help is available
  63. //    //    for "customNodeType3".
  64. //    //
  65. //    addAttributeEditorNodeHelp("customNodeType3",
  66. //        "print \"No help available yet for customNodeType3\\n\"");
  67. //
  68. //</doc>
  69.  
  70. global proc addAttributeEditorNodeHelp(
  71.     string $nodeType,
  72.     string $helpCommand)
  73. {
  74.     global string $gAttributeEditorNodeTypeArray[];
  75.     global string $gAttributeEditorHelpCommandArray[];
  76.  
  77.     int $count, $index, $length;
  78.  
  79.     $length = size($gAttributeEditorNodeTypeArray);
  80.  
  81.     //    Determine if the argument node type is already in the
  82.     //    array.
  83.     //
  84.     $count = stringArrayCount($nodeType, $gAttributeEditorNodeTypeArray);
  85.     
  86.     if (0 == $count) {
  87.         //
  88.         //    Not in array yet.
  89.         //
  90.         //    Add node type and help command.
  91.         //
  92.         $gAttributeEditorNodeTypeArray[$length] = $nodeType;
  93.         $gAttributeEditorHelpCommandArray[$length] = $helpCommand;
  94.  
  95.     } else {
  96.         //
  97.         //    Already in array.
  98.         //
  99.         //    Find index of node in array.
  100.         //
  101.         for ($index = 0; $index < $length; $index++) {
  102.             if ($nodeType == $gAttributeEditorNodeTypeArray[$index]) {
  103.                 break;
  104.             }
  105.         }
  106.  
  107.         //    Update help command.
  108.         //
  109.         $gAttributeEditorHelpCommandArray[$index] = $helpCommand;
  110.     }
  111. }
  112.  
  113.